#include <cstdio>
#include <iostream>
#define lowbit(x) (-x & x)
#define N 100010
using namespace std;

int n, q;
long long a[N], sum[N];

class TreeArray {
private:
	long long s[N];

public:
	void modify(int pos, long long val) {
		while (pos <= n) {
			s[pos] += val;
			pos += lowbit(pos);
		}
	}
	long long query(int pos) {
		long long res = 0;
		while (pos) {
			res += s[pos];
			pos -= lowbit(pos);
		}
		return res;
	}
} b, b_i;

int main() {
	// freopen("testdata.in", "r", stdin);
	// freopen("testdata.out", "w", stdout);
	scanf("%d%d", &n, &q);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
		sum[i] = sum[i - 1] + a[i];
	}
	int l = 0, r = 0;
	long long val = 0;
	char opt = 0;
	while (q--) {
		cin >> opt;
		switch (opt) {
		case 'Q':
			scanf("%d%d", &l, &r);
			printf("%lld\n", sum[r] + (r + 1) * b.query(r) - b_i.query(r) - (sum[l - 1] + l * b.query(l - 1) - b_i.query(l - 1)));
			break;

		case 'C':
			scanf("%d%d%lld", &l, &r, &val);
			b.modify(l, val);
			b.modify(r + 1, -val);
			b_i.modify(l, val * l);
			b_i.modify(r + 1, -val * (r + 1));
			break;
		}
	}
	// fclose(stdin);
	// fclose(stdout);
	return 0;
}